package com.fast.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

@Slf4j
@Configuration(proxyBeanMethods = false)//lite
public class RefreshConfig {
    private TestRefreshConfig testRefreshConfig;



    //    @PostConstruct
    private void init() {
        String old = null;

        new Thread(() -> {
            while (true) {
                String enable = testRefreshConfig.getEnable();
                log.info("RefreshConfig inner enable={} testRefreshConfig.hashCode={}", enable, testRefreshConfig.hashCode());
                try {
                    TimeUnit.SECONDS.sleep(4);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        }).start();
    }

}
